A for in loop automatically includes the property of any prototype object, consider checking the key using hasOwnProperty.
When iterating over the keys of an object, this includes not only the keys of the
object, but also keys contained in the prototype of that object. It is generally
a best practice to check for these keys specifically:
varsomeObject;for(varkeyinsomeObject){if(!someObject.hasOwnProperty(key)){continue;// Skip keys from the prototype.}doSomethingWith(key);}
Loading history...
28
if (en[translate_key] && !translate_key.hasOwnProperty('placeholders') && en[translate_key].hasOwnProperty('placeholders')) {
When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically: